package com.gzsxy.JUC.single;

import sun.dc.pr.PRError;

/**
 * 饿汉式单例模式简单实现，此种方式不会产生线程不安全情况，且只会创建一个对象。
 */
public class Hungry {

    //可能会浪费空间
    private byte[] data1 = new byte[1024 * 1024];
    private byte[] data2 = new byte[1024 * 1024];
    private byte[] data3 = new byte[1024 * 1024];
    private byte[] data4 = new byte[1024 * 1024];

    private Hungry() {

    }


    private final static Hungry HUNGRY = new Hungry();

    public static Hungry getInstance() {
        return HUNGRY;
    }

}
